function before(){
}
function init(){
	$("#previewBtn").filestyle({input: false, badge: false, buttonText: "上传"});
	$("#previewBtn").bind("change",function(){
		$.ajaxFileUpload({
            url:'base/attachment/upload',  
            fileElementId:'previewBtn',//file标签的id  
            dataType: 'json',//返回数据的类型  
            success: function (response, status) {
            	if(response.success){
                    $("#previewImg").attr("src", "base/attachment/download"+response.body.photoId);  
                    $("[name='photo']").val(response.body.photoId);  
            		$.messagebox.alert("上传成功","error");
            	}else{
            		$.messagebox.alert(response.message,"error");
            	}
            },  
            error: function (data, status, e) {  
                alert("上传失败");  
            }  
        });
		$("#previewBtn").val("");
	});
	$("#form0").form({
		"submitHandler":function(form) {
			$.post($(form).form("getUrl", "sys/admin"), $(form).form("getSerialize"), function(data) {
				if (data.success) {
					var opener = top.__t_tabGetOpenerWindow(window.name);
					if (opener) {
						opener.__g_reloadData();
						$.messagebox.alert($(form).form("getMsg","成功"), "success", function() {
							top.__t_tabClose(window.name);
						});
	
					}
	
				}else {
					$.messagebox.alert(data.returnMessage,"error");
				}
			}, "json").error(function(){
				alert("系统异常");
			});
		}
	});
	$("#roleList").select2();
}
function after(){
	
}

